package org.example;

import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.DateFormat;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;


/**
 * 销量预估单规格计算操作日志持久实体类
 * @author steven
 * @since 2022-08-24
 */

@Data
@Accessors(chain = true)
@Document(indexName = "m_estimate_sale_log_single")
public class MEstLogSinglePO  {


    /**
     * 跟计算相关连的id
     */
    @Id
    private String linkId;
    /**
     * 预估的日期
     */
    @Field(type = FieldType.Date, format = DateFormat.basic_date)
    private LocalDate day;
    /**
     * 站点id
     */
    @Field(type = FieldType.Integer)
    private Integer repoId;
    /**
     * 商品编号
     */
    @Field(type = FieldType.Integer)
    private Integer goodsId;
    /**
     * 销量预估-这两个都是一起保存的
     */
    @Field(type = FieldType.Integer)
    private Integer estimatedSales;
    /**
     * 参数-商品单站7日截尾均销A[最新数据]
     */
    @Field(type = FieldType.Double, index = false)
    private BigDecimal paraEqualizeRepoGoods;
    /**
     * 参数-指定日期-预估站点单量P
     */
    @Field(type = FieldType.Integer, index = false)
    private Integer paraRepoPredictNum;
    /**
     * 参数-站点7日截尾均单量B[最新数据]
     */
    @Field(type = FieldType.Double, index = false)
    private BigDecimal paraEqualizeRepo;

    /**
     *
     * ceil(商品单站7日截尾均销A最新-para_equalize_repo_goodsA[111] * (预估站点单量P-para_repoPredictNumP[222] / 站点7日截尾均单量B最新-equalizeRepoB[333])))
     */
    @Field(type = FieldType.Keyword, index = false)
    private String paraFormulaComputeDetail;

    @Field(type = FieldType.Date, format = DateFormat.basic_date_time_no_millis)
    private LocalDateTime createTime;
}
